#ifndef __LogManager_H__
#define __LogManager_H__

#include "Log.h"
#include "Singleton.h"

namespace PVM
{
	class LogManager : public Singleton<LogManager>
	{
	protected:
		typedef map<std::string, Log*> LogList;
		
		LogList mLogs;
		Log* mDefaultLog;
		
	public:
		PVM_AUTO_MUTEX
		
		LogManager();
		~LogManager();
		
		Log* createLog(const std::string& name, bool defaultLog = false, bool debuggerOutput = true,
					   bool suppressFileOutput = false);
		Log* getLog(const std::string& name);
		Log* getDefaultLog();
		void destroyLog(const std::string& name);
		void destroyLog(Log* log);
		
		Log* setDefaultLog(Log* newLog);
		void logMessage(const std::string& message, LogMessageLevel lml = LML_NORMAL,
						bool maskDebug = false);
		void LogMessage(LogMessageLevel lml, const std::string& message,
						bool maskDebug = false) {logMessage(message, lml, maskDebug);}
		
		Log::Stream stream(LogMessageLevel lml = LML_NORMAL,
						   bool maskDebug = false);
		void setLogDetail(LoggingLevel ll);
		static LogManager& getSingleton(void);
		static LogManager* getSingletonPtr(void);
	};
}

#endif
